precision highp float;
varying vec3 v_position;
uniform vec3 u_color;
uniform float u_time;
uniform float u_radius;
void main() {
    float v_op = 0.0;
    float borderWidth = 2.0;
    vec2 center = vec2(0.0, 0.0);
    float v_distance = distance(center, vec2(v_position));

    // float angle = tan(v_position.y);
    // float angle = sin(v_position.y);
    // float angle = atan(v_position.y);
    float angle = atan(v_position.y,v_position.x);
    float new_angle = mod(angle + u_time, 3.1415926 * 2.0);
    //边框上
    if(v_distance > u_radius - borderWidth) {
        v_op = 1.0;
    }
    if(v_distance < u_radius - borderWidth){
        v_op = 1.0-new_angle;
    }
    // 边框外
    if(v_distance > u_radius + borderWidth) {
        v_op = 0.0;
    }

    gl_FragColor = vec4(u_color, v_op);
}